package hiho;

import java.math.BigDecimal;
import java.util.Scanner;

/**
 * Created by qq65827 on 2015/2/4.
 */
public class BigDecimalHiho {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int num = Integer.valueOf(scanner.nextLine());
        BigDecimal[] resultSet = new BigDecimal[num] ;

        for (int i = 0; i < num; i++) {
            String line = scanner.nextLine();
            line.trim();
            String [] result = line.split(" ");
            BigDecimal a = new BigDecimal(result[0].trim());
            BigDecimal c = new BigDecimal(result[2].trim());
            char b = result[1].trim().charAt(0);
            switch (b) {
                case '+':
                    resultSet[i] = a.add(c);
                    break;
                case '-':
                    resultSet[i] = a.subtract(c);
                    break;
                case '*':
                    resultSet[i] = a.multiply(c);
                    break;
                case '/':
                    resultSet[i] = a.divide(c);
                    break;
            }
        }
        /**
         * 现在得到了一个bigDecimal的数组
         * 循环这个数组，用选择排序的思想
         */
        BigDecimal common = new BigDecimal(9);
        for (int i = 0; i < num; i++) {
            resultSet[i] = resultSet[i].subtract(common);
        }

        //找出最小的，打印出下标
        BigDecimal min = resultSet[0];
        int flag = 0;
        for (int i = 1 ; i < num; i++) {
            if (resultSet[i].compareTo(min) == -1) {
                //如果结果值比较小
                flag = i;
                min = resultSet[i];
            }
        }
        System.out.println(flag);

    }

}

